<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #fj{
            background-color: green;
            width: 100px;
            height: 20px;
            left: 600px;
            position: absolute;
            top: 580px;
        }
        #js{
            float: right;
        }
        #aaa{
            width: 1350px;
            height: 600px;
            z-index: -1;
            position: absolute;
        }
        #fs{
            font-size: 30px;
            color: rgb(255, 0, 212);
        }
        #js{
            font-size: 40px;
            color: red;
        }
    </style>
</head>
<body>
    <img id="aaa" src="231115101134127.jpg" alt="">
    <span id="js"></span>
    <div id="fj"></div>
    <span id="fs"></span>
    <script> 
        var js=document.getElementById('js');
        var fsi=document.getElementById('fs');
        var a=0;
        fsi.innerHTML=a;
        var fj=document.getElementById('fj');
        var fjoffset=600;
        var body=document.querySelector('body');
        body.addEventListener('keydown',function(e){
            if(e.keyCode==65){
                fjoffset-=20;
                fj.style.left=fjoffset+'px';
                if(fjoffset<0){
                    fjoffset=0;
                }
            }
            if(e.keyCode==68){
                fjoffset+=20;
                fj.style.left=fjoffset+'px';
                if(fjoffset>1250){
                    fjoffset=1250;
                }
           }
        });
        var z=setInterval(function(){
            var gg=document.createElement('img');
            gg.src='R-C.png';
            gg.style.width='100px';
            gg.style.height='100px';
            gg.style.backgroundColor='red';
            gg.style.position='absolute';
            var ggg=0;
            var ggg1=Math.round(Math.random()*1250);
            gg.style.left=ggg1+'px';
            body.insertBefore(gg,fj);
            var gggg=setInterval(function(){
                ggg+=10;
                gg.style.top=ggg+'px';
                if(ggg>500){
                    clearInterval(gggg);
                    body.removeChild(gg);
                    if(Math.abs(ggg1-fjoffset)<100){
                        a++;
                        fsi.innerHTML=a;
                    }
                }
            },40);
        },1000);
        var cx=60;
        var zd=setInterval(function(){
            cx--;
            js.innerHTML=cx;
            if(cx==0){
                clearInterval(zd);
                clearInterval(z);
                var x=document.createElement('div');
                x.style.width='1350px';
                x.style.height='600px';
                x.style.position='absolute';
                x.style.top='0px';
                x.style.left='0px';
                x.style.fontSize='200px';
                x.innerHTML='你得了'+a+'分';
                x.style.backgroundColor='green';
                body.appendChild(x);
            }
        },1000)
    </script>
</body>
</html>